from django.shortcuts import redirect, reverse


def login_required(func):
    def wrapper(request, *args, **kwargs):
        if request.frontuser:
            return func(request, *args, **kwargs)
        else:
            return redirect(reverse('front:index'))

    return wrapper
